package database

import (
	_ "github.com/jinzhu/gorm/dialects/mssql"
	_ "github.com/jinzhu/gorm/dialects/mysql"
	_ "github.com/jinzhu/gorm/dialects/postgres"
	"net/url"
)

type DbConfig struct {
	Dialect  string // 数据库类型(PostgreSQL:"postgres",SQL Server:"mssql",MySQL:"mysql")
	Host     string // 数据库IP
	Port     int    // 端口号
	UserName string // 用户名
	Password string // 密码
	DbName   string // 数据库名称
	Debug    bool   // 是否打印SQL日志
}

func (cfg *DbConfig) Translation() {
	cfg.UserName = url.QueryEscape(cfg.UserName)
	cfg.Password = url.QueryEscape(cfg.Password)
}
